#include "xpcom-config.h"
#include "mozilla/ModuleUtils.h"
#include "nsIClassInfoImpl.h"

#include "MyComponent.h"

#define COMPONENT_CONTRACTID "@nhn.com/MyComponent;1"
//const char* COMPONENT_CONTRACTID = "@nhn.com/MyComponent/hello;1";

//21050306-E46F-4DDA-A134-FA91C540AF57
const nsCID COMPONENT_CID = { 0x21050306, 0xE46F, 0x4DDA, {0xA1, 0x34, 0xFA, 0x91, 0xC5, 0x40, 0xAF, 0x57 } };

NS_GENERIC_FACTORY_CONSTRUCTOR(MyComponent)

NS_DEFINE_NAMED_CID(COMPONENT_CID);


// Build a table of ClassIDs (CIDs) which are implemented by this module. CIDs
// should be completely unique UUIDs.
// each entry has the form { CID, service, factoryproc, constructorproc }
// where factoryproc is usually NULL.
static const mozilla::Module::CIDEntry kComponentCIDs[] = {
    { &COMPONENT_CID, false, NULL, MyComponentConstructor },
    { NULL }
};

// Build a table which maps contract IDs to CIDs.
// A contract is a string which identifies a particular set of functionality. In some
// cases an extension component may override the contract ID of a builtin gecko component
// to modify or extend functionality.
static const mozilla::Module::ContractIDEntry kComponentContracts[] = {
    { COMPONENT_CONTRACTID, &COMPONENT_CID },
    { NULL }
};

// Category entries are category/key/value triples which can be used
// to register contract ID as content handlers or to observe certain
// notifications. Most modules do not need to register any category
// entries: this is just a sample of how you'd do it.
static const mozilla::Module::CategoryEntry kComponentCategories[] = {
    { "my-category", "my-key", COMPONENT_CONTRACTID },
    { NULL }
};


static const mozilla::Module kComponentModule = {
    mozilla::Module::kVersion,
    kComponentCIDs,
    kComponentContracts,
    kComponentCategories
};

// The following line implements the one-and-only "NSModule" symbol exported from this
// shared library.
NSMODULE_DEFN(ComponentModule) = &kComponentModule;

// The following line implements the one-and-only "NSGetModule" symbol
// for compatibility with mozilla 1.9.2. You should only use this
// if you need a binary which is backwards-compatible and if you use
// interfaces carefully across multiple versions.
NS_IMPL_MOZILLA192_NSGETMODULE(&kComponentModule)


